package org.devocean.groupbuying.dao.impl;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.devocean.groupbuying.dao.CompatibiliyDao;
import org.devocean.groupbuying.domain.Compatibility;
import org.springframework.stereotype.Component;

@Component
public class CompatibilityDaoImpl implements CompatibiliyDao{

	@PersistenceContext
	private EntityManager em;
	
	public List<Compatibility> findAllCompatibility() {
		
		return em.createQuery("SELECT comp FROM Compatibility comp",Compatibility.class).getResultList();
	}

	public Long countCompatibility() {
		
		return em.createQuery("SELECT COUNT(comp) FROM Compatibility comp",Long.class).getSingleResult();
	}

}
